class Overnight < DeskActionAggregate
  validates_presence_of :house_id
  validates_presence_of :wakeup_time
  
  belongs_to :house
  has_one :overnight_start,
          :class_name => "OvernightStart",
          :foreign_key => 'desk_action_aggregate_id'
  has_one :wakeup,
          :class_name => "Wakeup",
          :foreign_key => 'desk_action_aggregate_id'
          
  def currently_active
    if wakeup.nil?
      wakeup_time > Time.now
    else
      wakeup.effective_at > Time.now
    end
  end
end
